package clients;

import interfaces.IFabricanteRMI;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.util.ArrayList;

import valueobjects.FabricanteVO;

public class FabricanteRMIClient {
	public static void main(String[] args) {
		IFabricanteRMI fabricante;
		try {
			fabricante = (IFabricanteRMI) Naming
					.lookup("rmi://localhost:1099/fabricante");
			ArrayList<FabricanteVO> fabricantes = fabricante.obtemListaFabricantes();
			for (FabricanteVO fabricanteVO : fabricantes) {
				System.out.println(fabricanteVO.getNome());
			}
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NotBoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}